using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SSOConfigTool.Windows
{
    public partial class frmOpenApplication : Form
    {
        public frmOpenApplication()
        {
            InitializeComponent();
            this.AcceptButton = this.ucOKCancel1.OKButton;
            this.cboApplications.Items.AddRange(Program.SSOHelper.GetApplications().ToArray());
        }

        private string _selectedApplication = null;

        public string SelectedApplication
        {
            get { return this._selectedApplication; }
        }

        private void ucOKCancel1_OKClicked()
        {
            if (this.cboApplications.SelectedItem != null)
            {
                this._selectedApplication = this.cboApplications.SelectedItem.ToString();
            }
            else if (!string.IsNullOrEmpty(this.cboApplications.Text))
            {
                this._selectedApplication = this.cboApplications.Text.Trim();
            }
            this.Close();
        }

        private void ucOKCancel1_CancelClicked()
        {
            this.Close();
        }
    }
}